home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / gawk / gawk213s.zoo / gawk-src-2.13 / missing / strchr.c < prev    next >
Text File  |  1990-11-18  |  543b  |  36 lines

  1. /*
  2.  * strchr --- search a string for a character
  3.  *
  4.  * We supply this routine for those systems that aren't standard yet.
  5.  */
  6.  
  7. char *
  8. strchr (str, c)
  9. register char *str, c;
  10. {
  11.     for (; *str; str++)
  12.         if (*str == c)
  13.             return str;
  14.  
  15.     return NULL;
  16. }
  17.  
  18. /*
  19.  * strrchr --- find the last occurrence of a character in a string
  20.  *
  21.  * We supply this routine for those systems that aren't standard yet.
  22.  */
  23.  
  24. char *
  25. strrchr (str, c)
  26. register char *str, c;
  27. {
  28.     register char *save = NULL;
  29.  
  30.     for (; *str; str++)
  31.         if (*str == c)
  32.             save = str;
  33.  
  34.     return save;
  35. }
  36.